<template>
  <div class="news_details">
    <Header active="3" />
    <!-- banner -->
    <div
      class="page_banner"
      :style="{'background-image': 'url('+cateInfo.image+')'}"
    >
      <div class="page-inner">
        <h1 class="f60 font-b">{{cateInfo.name}}</h1>
      </div>
    </div>
    <!-- tabs -->
    <Tabs :tabsList="NewsTabs" tabsActive="true" />
    <!-- details -->
    <div class="page-inner page-padding wrap">
      <h1 class="f36 font-m">
        {{dataInfo.title}}
      </h1>
      <div class="f18 font-r box">
        <span>{{dataInfo.author}}</span>
        <span>{{dataInfo.show_time}}</span>
      </div>
      <div class="content" v-html="dataInfo.content" v-if="dataInfo.content">
      </div>
	  <!-- <p class="f16 font-r">
	     Our team will be presenting the latest advancements inAl-driven
	     toxicology at the AAPS
	   </p>
	   <div class="img_box">
	     <img src="/public/uploadfiles/image/About-AITEP_03.jpg" />
	   </div> -->
      <div class="button_box flex">
        <div class="f18 font-m">
          <p v-if="dataInfo.prev" @click="toInfo(dataInfo.prev.id)">
            Previous article: <span
              >{{dataInfo.prev.title}}</span
            >
          </p>
          <p v-if="dataInfo.next" @click="toInfo(dataInfo.next.id)">
            Next article: 
            <span
              >{{dataInfo.next.title}}</span
            >
          </p>
        </div>
        <div class="button" @click="$router.push({path:'/News'})">
          <i></i>
          return
        </div>
      </div>
    </div>
  </div>
</template>
<script>
import { getArticleIinfo,getCategoryList } from '@/api/sections'
export default {
	data() {
	    return {
			NewsTabs:[{ id: "0", name: "News", url: "/News" }],
			dataInfo:{},
			cateInfo:{}
	    }
	},
    mounted:function(){
		this.initData()
		
		
    },
	methods:{
		toInfo(id){
			
			this.$router.push({
			  path: `/News/${id}`,
			});
		},
		initData(){
				getCategoryList({'cid':1422}).then((res)=>{
					  this.cateInfo=res.data
				})
			this.getData()
		},
		getData(){
			let post={
				id:this.$route.params.details,
				sort:this.$route.params.details,
			}
			getArticleIinfo(post).then((res)=>{
				console.log(res,1111)
				  this.dataInfo=res.data
			
			})
		}
	}
}
</script>
